<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>系统管理布局</title>
    <link rel="stylesheet" href="./layui/css/layui.css">
    <script src="jquery-3.6.0.js"></script>
</head>
<body onload="">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo layui-hide-xs layui-bg-black">性格测试后台系统</div>
        <!-- 头部区域（可配合layui 已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">
            <!-- 移动端显示 -->
            <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-header-event="menuLeft">
                <i class="layui-icon layui-icon-spread-left"></i>
            </li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide layui-show-md-inline-block">
                <a href="javascript:;">
                    <img th:src="@{user.headPortrait}" class="layui-nav-img">
                    <span id="userName" th:text="${user}!=null?${user.userName}:'非法访问'"></span>
                </a>
                <dl class="layui-nav-child">
                    <a href="javascript:window.location.href='/showAdminLogin';">注销</a>
                </dl>
            </li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li th:each="menu:${menu}" class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;"><i th:class="${menu.icon}"></i><span th:text="${menu.title}"></span></a>
                    <dl class="layui-nav-child" th:each="child:${menu.children}">
                        <dd><a th:href="${child.url}"><i th:class="${child.icon}"></i><span
                                th:text="${child.title}"></span></a></dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <!-- 内容主体区域 -->
        <iframe id="iframe" src="/toResultAll" class="layadmin-iframe" frameborder="0"
                style="width: 100%;height: 100%" onload="fuzhi()"></iframe>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        ©第一组出品
    </div>
</div>
<script src="./layui/layui.js"></script>
<script>
        if ($("#userName").html() === '非法访问') {
            window.location.href = '/unau.html';
        }

    //JS
    layui.use(['element', 'layer', 'util'], function () {
        var element = layui.element
            , layer = layui.layer
            , util = layui.util
            , $ = layui.$;
        $(function () {
            $("dd>a").click(function (event) {
                event.preventDefault();
                $("#iframe").attr("src", $(this).attr("href"));
            })
        })

    });

    function fuzhi() {
        $("#iframe").contents().find("#creator").val($("#userName").html());
        $("#iframe").contents().find("#updater").val($("#userName").html());
    }
</script>
</body>
</html>